import { Form, Input, Button, InputNumber } from 'antd';
import { useForm } from './components/Form/useForm';
import CreateActivity from './fissionForm/components/CreateActivity';
import TestChild from './components/ChildForm'

const App = () => {

  const [form] = Form.useForm();
  const layout = {
    labelCol: { span: 8 },
    wrapperCol: { span: 16 },
  };
  const onFinish = (values: any) => {
    console.log(values);
  };

  const submitForm = async () => {
    await form.validateFields();
    console.log(form.getFieldsValue());
  }


  return (
    // <CreateActivity />
    <div onClick={() => {  console.log('submit parent')}}>
      <Form {...layout} form={form} name="nest-messages" onFinish={onFinish} >
        <Form.Item name={['user', 'name']} label="Name" rules={[{ required: true }]}>
          <Input />
        </Form.Item>
        <Form.Item name={['user', 'email']} label="Email" rules={[{ type: 'email' }]}>
          <Input />
        </Form.Item>
        <Form.Item name="child">
          <TestChild form={form} />
        </Form.Item>
      </Form>
      
      <Button type="primary" onClick={submitForm} >提交</Button>
      <div onClick={() => { console.log('test_wrapper') }}>
        <div onClick={() => { console.log('test') }}>111</div>
      </div>
    </div>
  );
};

export default App;
